#include<iostream>
using namespace std;
#include<unistd.h>
#include<sys/stat.h>
#include<fcntl.h>

int main(){
    pid_t id = fork();

    if(id == 0){
        while(1){
            cout<<"我是子进程:pid:"<<getpid()<<"--ppid:"<<getppid()<<endl;
            sleep(1);
        }
    }

    int cnt = 7;
    while(cnt--){
        cout<<"我是父亲进程，cnt:"<<cnt<<endl;
        sleep(1);
    }

    exit(1);//

    return 0;
}